﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using Model.WWW_User.Mail;
using BLL.WWW_User.Mail;
using System.Collections;
using Model;



namespace BLF.WWW_User.UserMail
{
    public class Mail
    {
        static public bool WriteInform(string memberNo, string fromId, string title, string message)
        {
            MailSystem ms = new MailSystem();
            MailModel mm = new MailModel();
            mm.ToNo = memberNo;
            mm.FromNo = fromId;
            mm.PM_Tittle = title;
            mm.PM_Message = message;
            return ms.WriteInform(mm);

        }
        #region vincent
        /// <summary>
        /// 得到我发出的信息（0：邮件列表List MailModel、1：邮件总数、2：邮件未读数）
        /// </summary>
        /// <param name="memberno">会员号</param>
        /// <param name="pageIndex">页</param>
        /// <param name="pageSize">大小</param>
        /// <returns>ArrayList（0：邮件列表List MailModel、1：邮件总数、2：邮件未读数）</returns>
        static public ArrayList GetMyOutMails(string memberno, int pageIndex, int pageSize)
        {
            MailSystem ms = new MailSystem();
           return ms.GetMyOutMails(memberno, pageIndex, pageSize);
        }
        /// <summary>
        /// 删除pmid的信息得到我发出的信息（0：邮件列表List MailModel、1：邮件总数、2：邮件未读数）
        /// </summary>
        /// <param name="memberno">会员号</param>
        /// <param name="pmid">删除消息的id</param>
        /// <param name="pageIndex">页</param>
        /// <param name="pageSize">大小</param>
        /// <returns>ArrayList（0：邮件列表List MailModel、1：邮件总数、2：邮件未读数）</returns>
        static public ArrayList DelMyOutMails(string memberno, string pmid, int pageIndex, int pageSize)
        {
            MailSystem ms = new MailSystem();
            return ms.DelMyOutMails(memberno, pmid, pageIndex, pageSize);
        }
        /// <summary>
        /// 删除pmid的信息得到我发出的信息（0：邮件列表List MailModel、1：邮件总数、2：邮件未读数）
        /// </summary>
        /// <param name="memberno">会员号</param>
        /// <param name="pmid">删除消息的id串</param>
        /// <param name="pageIndex">页</param>
        /// <param name="pageSize">大小</param>
        /// <returns>ArrayList（0：邮件列表List MailModel、1：邮件总数、2：邮件未读数）</returns>
        static public ArrayList DelCMyOutMails(string memberno, string pmid, int pageIndex, int pageSize)
        {
            MailSystem ms = new MailSystem();
            return ms.DelCMyOutMails(memberno, pmid, pageIndex, pageSize);
        }
        #endregion

        #region snail
        /// <summary>
        /// 获取所有通知。
        /// </summary>
        /// <param name="memberno">会员编号。</param>
        /// <returns>返回NotifyModel集合。</returns>
        static public List<NotifyModel> GetNotifies(string memberno)
        {
            MailSystem ms = new MailSystem();
            return ms.GetNotifies(memberno);
        }

        /// <summary>
        /// 删除指定通知。
        /// </summary>
        /// <param name="memberno">会员编号。</param>
        /// <param name="id">通知编号。</param>
        /// <returns>返回受影响的行数。</returns>
        static public int DelNotify(string memberno, string id)
        {
            MailSystem ms = new MailSystem();
            return ms.DelNotify(memberno, id);
        }
        /// <summary>
        /// 先删除再获取所有通知。
        /// </summary>
        /// <param name="memberno">会员编号。</param>
        /// <returns>返回NotifyModel集合。</returns>
        static public List<NotifyModel> DelNotifies(string memberno, string id)
        {
            MailSystem ms = new MailSystem();
            return ms.DelNotifies(memberno, id);
        }
        /// <summary>
        /// 将所有通知状态设置为已读。
        /// </summary>
        /// <param name="memberno">会员编号。</param>
        /// <returns>返回受影响的行数。</returns>
        static public int SetAllRead(string memberno)
        {
            MailSystem ms = new MailSystem();
            return ms.SetAllRead(memberno);
        }

        /// <summary>
        /// 获得一个Mail对象的详细信息。
        /// </summary>
        /// <param name="memberno">会员编号。</param>
        /// <param name="id">Mail编号。</param>
        /// <returns></returns>
        static public MailModel GetMailDetail(string memberno, int id)
        {
            MailSystem ms = new MailSystem();
            return ms.GetMailDetail(memberno, id);
        }

        /// <summary>
        /// 回复消息(0：昵称、1：头像、2：时间)
        /// </summary>
        /// <param name="memberno">会员编号。</param>
        /// <param name="msgID">消息编号。</param>
        /// <param name="parentID">父ReplyID</param>
        /// <param name="body">回复内容。</param>
        /// <returns>(0：昵称、1：头像、2：时间)</returns>
        static public ArrayList ReplyMessage(string memberno, int msgID, string parentID, string body)
        {
            MailSystem ms = new MailSystem();
            return ms.ReplyMessage(memberno, msgID, parentID, body);
        }

        static public int DeleteMessage(int pmid, string memberno)
        {
            MailSystem ms = new MailSystem();
            return ms.DeleteMessage(pmid,memberno);
        }

        #endregion

        #region HUI
        /// <summary>
        /// 获取我的收件箱信息（0：邮件列表List MailModel、1：邮件总数 int、2：未读邮件数 int）
        /// </summary>
        /// <param name="memberno">当前会员号</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <returns>（0：邮件列表List MailModel、1：邮件总数 int、2：未读邮件数 int）</returns>
        public static ArrayList GetMyInboxInfo(string memberno, int pageIndex, int pageSize)
        {
            return new MailSystem().GetMyInboxInfo(memberno, pageIndex, pageSize);
        }
        /// <summary>
        /// 删除邮件，获取我的收件箱信息（0：邮件列表List MailModel、1：邮件总数 int、2：未读邮件数 int）
        /// </summary>
        /// <param name="memberno">当前会员号</param>
        /// <param name="pageSize">pageSize</param>
        /// <param name="pm_IDs">删除的邮件ID（,分隔）</param>
        /// <returns>（0：邮件列表List MailModel、1：邮件总数 int、2：未读邮件数 int）</returns>
        public static ArrayList Del_MyInboxInfo(string memberno, int pageSize, string pm_IDs)
        {
            return new MailSystem().Del_MyInboxInfo(memberno, pageSize, pm_IDs);
        }
        /// <summary>
        /// 更新消息已读状态
        /// </summary>
        /// <param name="memberno">当前会员号</param>
        /// <param name="isRead">阅读状态</param>
        /// <param name="pm_IDs">信件ID（,分隔）</param>
        /// <returns>CommonMessage</returns>
        public static CommonMessage UpdateIsRead(string memberno, bool isRead, string pm_IDs)
        {
            return new MailSystem().UpdateIsRead(memberno, isRead, pm_IDs);
        }
        #endregion
        /// <summary>
        /// 获得一个Mail对象的详细信息。
        /// </summary>
        /// <param name="memberno">会员编号。</param>
        /// <param name="id">Mail编号。</param>
        /// <param name="idflag">取得邮件类型（'1'收件箱下，'2'--收件箱上，'3'--发件箱下，'4'--发件箱上，其他当前ID邮件）</param>
        /// <returns>MailModel</returns>
        public static MailModel GetMailDetail(string memberno, int id, string idflag)
        {
            return new MailSystem().GetMailDetail(memberno, id, idflag);
        }
    }
}
     